package com.gregbugaj.nscaffold.node;

import java.util.ArrayList;
import java.util.List;

import com.gregbugaj.nscaffold.generator.Visitable;
import com.gregbugaj.nscaffold.generator.Visitor;

/**
 * 
 * @author gbugaj
 *
 */
public class PClass implements Visitable{
	private List<PropertyInfo> properties;
	private String entityName;
	private Class<?> entityClass;
	private String table;

	public PClass() {
	   properties=new ArrayList<PropertyInfo>();
	}
	
	
	public String getEntityName() {
		return entityName;
	}

	public void setEntityName(String entityName) {
		this.entityName = entityName;
	}

	  
	public void addProperty(PropertyInfo property) {
		
		properties.add(property);
	}

	public String getTable() {
		return table;
	}

	public void setTable(String table) {
		this.table = table;
	}

	public List<PropertyInfo> getProperties() {
		return properties;
	}

	public void setProperties(List<PropertyInfo> properties) {
		this.properties = properties;
	}

	/**
	 * Visitor Pattern method to visit this object
	 * @param visitor
	 */
	@Override
	public void accept(Visitor visitor) {
		visitor.visit(this);		
	}


	public Class<?> getEntityClass() {
		return entityClass;
	}


	public void setEntityClass(Class<?> entityClass) {
		this.entityClass = entityClass;
	}
	
	@Override
	public String toString() {
		return entityName+":"+entityClass;
	}

}
